load("@rules_mojo//mojo:mojo_shared_library.bzl", "mojo_shared_library")
load("//bazel:api.bzl", "modular_py_test")

package(default_visibility = ["//visibility:private"])

mojo_shared_library(
    name = "mojo_module_a",
    testonly = True,
    srcs = [
        "common.mojo",
        "mojo_module_a.mojo",
    ],
    shared_lib_name = "mojo_module_a.so",
    target_compatible_with = select({
        "//:asan": ["@platforms//:incompatible"],
        "//:tsan": ["@platforms//:incompatible"],
        "//:ubsan": ["@platforms//:incompatible"],
        "//conditions:default": [],
    }),
    deps = [
        "@mojo//:stdlib",
    ],
)

mojo_shared_library(
    name = "mojo_module_b",
    testonly = True,
    srcs = [
        "common.mojo",
        "mojo_module_b.mojo",
    ],
    shared_lib_name = "mojo_module_b.so",
    target_compatible_with = select({
        "//:asan": ["@platforms//:incompatible"],
        "//:tsan": ["@platforms//:incompatible"],
        "//:ubsan": ["@platforms//:incompatible"],
        "//conditions:default": [],
    }),
    deps = [
        "@mojo//:stdlib",
    ],
)

modular_py_test(
    name = "main",
    srcs = ["test_module.py"],
    tags = ["no-mypy"],  # Fails to find mojo_module.so
    deps = [
        ":mojo_module_a",
        ":mojo_module_b",
    ],
)
